<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 展开运算符 ...

        // 展开数组,数组合并
        let arr = [1,2,3,4]
        let arr1 = [5]
        let res = [...arr,...arr1]
        console.log(res);

        // 求数组最大值
        var arr2 = [ 1,2,5,7,22,3]
        var res1 = Math.max(...arr2)
        console.log(res1);

        // 伪数组转换为数组
        function fn(){
            console.log(arguments);

            // 1.0 转换
            var arr3 = Array.from(arguments);
            console.log(arr3);

            // 2.0 展开方式
            var arr = [...arguments]
            console.log(arr);
        }
        fn(1,2,3,4)


        // 不定参形式
        function fn(a,...arguments){
            console.log(arguments);
            console.log(a);
        }
        fn(1,2,43,5)


        // 对象的展开
        // 合并对象，合并配置
        let obj1 = {name:"张三"};
        let obj2 = {age:20};
        var obj = {...obj1,...obj2};
        console.log(obj);

        // 字符串的展开
        var str = '21313213'
        var arr5 = str.split('')
        var arr4 = [...str]

        var arr6 = arr4.map(Number)
        console.log(arr4);
        console.log(arr5);
        console.log(arr6);
    </script>
</body>
</html>